Using a Callback Function to Manage Buffered Playback

You can define your own callback function to manage buffered playback of MIDI output devices. The callback function is documented as MidiOutProc1UBLE3H.

The following messages can be sent to the wMsg parameter of the MidiOutProc callback function.

MOM_CLOSEVGC1D.

Sent when the device is closed by using the midiOutClose2.G._BN function.

MOM_DONE0AIATP

Sent when the device driver is finished with a data block sent by using the midiOutLongMsg10239RN or midiStreamOut060OP9 function.

MOM_OPEN0ATBKY

Sent when the device is opened by using the midiOutOpen1UBKBTS function.

 

These messages are similar to those sent to window procedure functions, but the parameters are different. A handle of the open MIDI device is passed as a parameter to the callback function, along with the doubleword of instance data passed by using midiOutOpen.

After the driver is finished with a data block, you can clean up and free the data block. Because of the suggested restrictions on callback functions, it is better not to do this from within the callback function.